<script>
    var array=["22222","a","aaaaaa"];
    var newArray=[];
    for (let i = 0; i < array.length; i++) {
       var length=array[i].length;
        newArray[i]=length;
    }
    console.log(newArray);
</script>